<script type="text/javascript">
	selectTab('about_contest');
</script>

<?php
if(!empty($this->contest->id)):
	/* @var $contest Core_Model_Contest */
	$contest = $this->contest;
?>

	<!-- Share to another social networks -->
    <?php
        $furl = $this->social->getShareUrl('/contest/share/contest/id_page/'.$this->social->getIdPage().'/id_contest/'.$this->contest->id);    
        $url = $this->contest->getShareUrlSocialNetworks(array(), FALSE);
        $url_facebook = $this->contest->getShareUrlSocialNetworks(array(), TRUE);
    ?>
     <div class="like-another-social-networks">
        <?php
            $info = $this->contest->getSharedContent($this->id_page);
        ?>
        <?php echo $this->partial('like-to-social-networks.phtml', array(
            'url'			=> $url,
            'url_facebook'	=> $url_facebook,
            'id_page'       => $this->id_page,
            'id_user'		=> $this->id_user?$this->id_user:ID_USER_CHEAT_FOR_COUNT_SHARE,
            'show_text'		=> true,
            'message'		=> YouNet_Util::escapeForJs(sprintf($this->translate('REQUEST_MESSAGE'), $this->contest->title, $this->contest->getPageName($this->id_page))),
            'send'			=> false,
            'show_faces'	=> false,
            'show_fb_like'	=> false,
            'page_url'      => $_SERVER['HTTP_HOST'].$this->pageUrl(),
            'img'           => $this->shareRow->getShareImage(),
            'title'         => $info['title'],
        ));?>
    </div>
    <div class="share-another-social-networks">  
        <?php
            $info = $this->contest->getSharedContent($this->id_page);
        ?>
        <?php echo $this->partial('share-to-social-networks.phtml', array(
            'url'			=> $url,
            'url_facebook'	=> $url_facebook,
            'furl'          => $furl,
            'id_page'       => $this->id_page,
            'id_user'		=> $this->id_user?$this->id_user:ID_USER_CHEAT_FOR_COUNT_SHARE,
            'show_text'		=> true,
            'message'		=> YouNet_Util::escapeForJs(sprintf($this->translate('REQUEST_MESSAGE_CONTEST'), $this->contest->title, $this->contest->getPageName($this->id_page))),
            'send'			=> false,
            'show_faces'	=> false,
            'show_fb_like'	=> false,
            'page_url'      => $_SERVER['HTTP_HOST'].$this->pageUrl(),
            'title'         => $info['title'],
            'description'   => nl2br($this->escape($this->contest->description)), 
            'invite_url'    => $this->contest->getInviteUrlSocialNetworks(array()),
            'is_contest'    => TRUE
        ));?>
    </div>

	<div class="contest_detail" style="clear:both;">
		<?php echo $contest->description; ?>
		<?php echo $contest->template_prize; ?>
	</div>

<?php endif;?>

<div class="group_button">
	<a class="fanpage_button view_entries" href="<?php echo $this->pageUrl(array('target' => 'view'), true); ?>">
		<?php echo $this->translate('MENU_VIEW_ENTRIES')?>
	</a>
    <a class="fanpage_button submit_entry" href="javascript:void(0);"
       onclick="$('#link_submit_entry').click();" >
		<?php echo $this->translate('MENU_SUBMIT_AN_ENTRY')?>
	</a>
</div>

<?php echo $this->social->render('comment',
	array(
		'url' => $this->social->getShareUrl('/contest/share/contest/id_page/'.$this->social->getIdPage().'/id_contest/'.$this->contest->id),
        'width' => 810
	))
?>

<script type="text/javascript">
    $(document).ready(function(){
        var ajax_url = '<?php echo $this->baseUrl('/contest/index/notify')?>';
        var data = {
            url: "<?php echo $this->social->getShareUrl('/contest/share/contest/id_page/'.$this->social->getIdPage().'/id_contest/'.$this->contest->id); ?>",
            id_contest: "<?php echo $this->contest->id?>",
            is_contest: '1'
        };
        Social.handleCommentNotify(ajax_url, data);
    });
</script>